package se480.tracker.util;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import se480.tracker.TrackerConstants;

/**
 * Used by simulation to read the input events file
 * 
 * @author mmichalak
 *
 */
public class EventFileReader {
	static Logger logger = Logger.getLogger(EventFileReader.class.getName());
	
	public List<String> readFile() {
        ArrayList<String> lines = new ArrayList<String>();

        try {
	        String sCurrentLine;
	 
	        /*FileReader r = new FileReader(
					FileReadTest.class.getClassLoader().getResource(fileName).getPath()
			        .replaceAll("%20", " "));*/
	        
	        lines = new ArrayList<String>();
	      
	        BufferedReader br = 
	            new BufferedReader(new FileReader("c:\\SE480\\" + TrackerConstants.INPUT_EVENT_FILENAME));
	        
	        int N = 0;
	        while ((sCurrentLine = br.readLine()) != null) {
	        	lines.add(sCurrentLine);
	        	N++;
		       //logger.debug(sCurrentLine);
	        } 	 			   			        			  
		} catch (FileNotFoundException e) {
	        e.printStackTrace();
	    } catch (IOException e) {
	        e.printStackTrace();
	    }   
	    
	    return lines;
	}

}
